var qQuery = new Query({container:$("#listWrap")});
var sSearch = new Search({ container : $("#searchWrap")});
var click = new Click({container: $("#tab_icon")});

var Main = RichBase.extend({
	statics : {},
	EVENTS : {},
	init : function(opt){
		var that = this;
		this.container = opt.container;
		this.prevBtn = $("#prevPageBtn");
		this.nextBtn = $("#nextPageBtn");
		sSearch.on("search",function(opt){
			//console.log(opt)
			var clickData = click.getData();
			that.prevBtn.addClass("disable");
			$("#whichPageNum").text(1)
			qQuery.setCurPage(0);
			qQuery.setData();
			qQuery.query(opt);
		});
		sSearch.on("outload",function(opt){
			//console.log(opt)
			//qQuery.outload(opt);
		});
		qQuery.on("no_next",function(res){
			that.nextBtn.addClass("disable");
		});
		qQuery.on("has_next",function(res){
			that.nextBtn.removeClass("disable");
		});
		qQuery.on("query_nexta",function(last){
			var searchData = sSearch.getData();
			var clickData = click.getData();
			qQuery.query({
				role : searchData.role,
				dname : searchData.dname,
				dstatus : clickData.dstatus,
				last : last
			})
		});
		qQuery.on("query_ago",function(last){
			var searchData = sSearch.getData();
			var clickData = click.getData();
			qQuery.query({
				dname : searchData.dname,
				role : searchData.role,
				dstatus : clickData.dstatus,
				last : last
			})
		});
		qQuery.query();
		$(".prevBtn").attr("data-last","");
	},
});



new Click({container:$("#tab_icon")});
new Main({container:$("#mlistUl")});